home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / amphibia_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  6.1 KB  |  155 lines

  1.  
  2. function units_amphibia_alien_setup()
  3.     units_setup(4,true,ENET_EFFECT_PS_SETUPSMOKE_MEDIUM,ENET_EFFECT_GEOMETRY_AMPHIBIAALIENSHADOW)
  4.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_AMPHIBIASMOKE)
  5.  
  6. end
  7.  
  8. function units_amphibia_alien_resetup()
  9.     units_setup(4,true,nil,ENET_EFFECT_GEOMETRY_AMPHIBIAALIENSHADOW)
  10.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_AMPHIBIASMOKE)
  11. end
  12.  
  13. function units_amphibia_alien_select()
  14.     units_select(22,1)
  15. end
  16.  
  17. function units_amphibia_alien_unselect()
  18.     units_unselect()
  19. end
  20.  
  21. function units_amphibia_alien_selectenemy()
  22.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  23. end
  24.  
  25. function units_amphibia_alien_damaged()
  26.     uniGetExecutor():applyDamage(uniGetLife())
  27. end
  28.  
  29. function units_amphibia_alien_highlight()
  30.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  31. end
  32.  
  33. function units_amphibia_alien_explode()
  34.     units_explode_small3_green()
  35. end
  36.  
  37. function units_amphibia_alien_move()
  38.     local unit = uniGetExecutor()
  39.     local sound = unit:play3DSound("amphibia_alien_move.wav",1)
  40.     unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI)
  41.     local eng_smoke = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_AMPHIBIASMOKE)
  42.     local eng_smoke2 = unit:addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE4)
  43.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.0))
  44.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  45.     eng_smoke:suspendedDestroy(2.0)
  46.     eng_smoke2:suspendedDestroy(5.0)
  47.     sound:destroy()
  48.     unit:play3DSound("amphibia_alien_stop.wav",0):destroy()
  49. end
  50.  
  51. function units_amphibia_alien_fire()
  52.     local unit = uniGetExecutor()
  53.     uniSetLife(uniGetLife() / 2.0)
  54.     local gt = unit:getBone(ENBT_GUNTOWER)
  55.     local gun = gt:getBone(ENBT_GUN)
  56.     local sound = gt:play3DSound("amphibia_alien_guntower_rotate.wav",1)
  57.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  58.     waitDeath(gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  59.     sound:stopSound()
  60.     gt:play3DSound("machinegunburstfire.wav",0):destroy()
  61.     local firespots = {}
  62.     firespots[0] = gt:getBone(ENBT_FIRE1,0)
  63.     firespots[1] = gt:getBone(ENBT_FIRE1,1)
  64.     firespots[0]:addSimpleEffect(ENET_EFFECT_LIGHT_MACHINEGUNFIRE):delayedDestroy(2.0)
  65.     local pss = {}
  66.     pss[0] = firespots[0]:addSimpleEffect(ENET_EFFECT_PS_MACHINEGUNFIRE)
  67.     pss[1] = firespots[1]:addSimpleEffect(ENET_EFFECT_PS_MACHINEGUNFIRE)
  68.     firespots[0]:addBulletEffect(ENET_EFFECT_BULLET_MACHINEGUNFIRE):executeCommand(ENC_FIRE1)
  69.     firespots[1]:addBulletEffect(ENET_EFFECT_BULLET_MACHINEGUNFIRE):executeCommand(ENC_FIRE1)
  70.     pause(1.0)
  71.     pss[0]:suspendedDestroy(1.0)
  72.     pss[1]:suspendedDestroy(1.0)
  73.     unit:addFireArrow()
  74. end
  75.  
  76. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_MOVE,"units_amphibia_alien_move")
  77. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_FIRE1,"units_amphibia_alien_fire")
  78. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_FIRE2,"units_amphibia_alien_fire")
  79. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_SELECT,"units_amphibia_alien_select")
  80. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_SELECTENEMY,"units_amphibia_alien_selectenemy")
  81. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_UNSELECT,"units_amphibia_alien_unselect")
  82. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_SETUP,"units_amphibia_alien_setup")
  83. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_RESETUP,"units_amphibia_alien_resetup")
  84. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_DAMAGED,"units_amphibia_alien_damaged")
  85. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_EXPLODE,"units_amphibia_alien_explode")
  86. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_HIGHLIGHT,"units_amphibia_alien_highlight")
  87. registerCommand(ENSCRIPTSET_AMPHIBIA_ALIEN,ENC_INSIDE,"units_inside")
  88.  
  89. -- make description of unit
  90. desc = getEffectDescriptionP(ENET_UNIT_AMPHIBIA_ALIEN)
  91. desc.ClassID = ENCLASS_MESHINSTANCE
  92. desc.EffectClassType = ENECT_GEOMETRY
  93. desc.FileName = "amphibia_alien.rmd"
  94. desc.ScriptSet = ENSCRIPTSET_AMPHIBIA_ALIEN
  95. desc.MoveType = ENMOVE_AMPHIBIAN
  96. desc.RenderType = ENRENDERTYPE_GEOMETRY
  97. desc.Material = ENMAT_RIGIDSKINNEDMESH
  98. desc.MaterialColors = units_materialcolors_human
  99.  
  100. -- shadow
  101. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_AMPHIBIAALIENSHADOW)
  102. desc.ClassID = ENCLASS_MESHINSTANCE
  103. desc.EffectClassType = ENECT_GEOMETRY
  104. desc.FileName = "amphibia_alien_shadow.rmd"
  105. desc.RenderType = ENRENDERTYPE_SHADOW
  106. desc.Material = ENMAT_SHADOW
  107. desc.MaterialColors = units_materialcolors_shadow
  108.  
  109. -- register new unit to logic
  110. unitDesc = logic_getUnitDescP(20)
  111. unitDesc.group = 1
  112. unitDesc.order = 1
  113. unitDesc.unit_res_id = ENET_UNIT_AMPHIBIA_ALIEN
  114. unitDesc.unit_icon_id = "Amphibia_a_small_normal.dds"
  115. unitDesc.active_id = "Amphibia_a_small_active.dds"
  116. unitDesc.pressed_id = "Amphibia_a_small_pressed.dds"
  117. unitDesc.small_icon_id = "Amphibia_l_stats.dds"
  118. unitDesc.big_icon_id = "Amphibia_a_big_normal.dds"
  119. unitDesc.HP = 4
  120. unitDesc.MP = 30
  121. unitDesc.WR = 1
  122. unitDesc.min_WR = 1
  123. unitDesc.WD = 2
  124. unitDesc.WR2 = 0
  125. unitDesc.min_WR2 = 0
  126. unitDesc.WD2 = 0
  127. unitDesc.ability = 2
  128. unitDesc.transport = 0
  129. unitDesc.value = 3
  130. unitDesc.race = 1
  131. unitDesc.fire_pause = 0.75
  132. unitDesc.move_pause = 1.0
  133. unitDesc.unit_info_scale = 0.06
  134. unitDesc.scn_name = "AMPHIBIAA"
  135.  
  136. ------------------------------------------------------------------------------------------------------
  137. ------------------------ effects related to unit------------------------------------------------------
  138. ------------------------------------------------------------------------------------------------------
  139.  
  140. function bullets_machinegun_fire()
  141.     local bullet = uniGetExecutor()
  142.     bullet:setTransformOwner()
  143.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,2000,uniGetTarget()),1000)
  144.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_MACHINEGUNFIREHIT)
  145.     local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_MACHINEGUNFIREHIT)
  146.     pause(1.0)
  147.     uniGetTarget():executeCommand(ENC_DAMAGED)
  148.     light:destroy()
  149.     hit_ps:suspendedDestroy(1.0)
  150.     pause(1.0)
  151.     bullet:destroy()
  152. end
  153.  
  154. registerCommand(ENSCRIPTSET_BULLET_MACHINEGUNFIRE,ENC_FIRE1,"bullets_machinegun_fire")
  155.